home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / prg_casm / jlvesa11.zip / JLVESA23.ASM < prev    next >
Assembly Source File  |  1995-11-14  |  2KB  |  88 lines

  1. ; This routine is part of the VESA SVGA -library
  2. ;
  3. ; Copyright 1994 Johannes Lehtinen
  4. ; All rights reserved
  5.  
  6. model large,c
  7. p386
  8.  
  9. include "jlvesads.asm"
  10.  
  11. extrn vesa_repos_r:far
  12.  
  13. segment jlvesa23_TEXT USE16 'CODE'
  14. assume cs:jlvesa23_TEXT
  15.  
  16. ; JVUByte JVPixel_Read(JVSWord x, JVSWord y)
  17.  
  18. proc JVPixel_Read far
  19.    public JVPixel_Read
  20.  
  21.    push  bp
  22.    mov   bp,sp
  23.    push  ds
  24.    push  es
  25.    push  di
  26.  
  27.    mov   ax,JLVesa_Data
  28.    mov   ds,ax
  29.  
  30.    ; Check that pixel is on the screen
  31.  
  32.    mov   ax,[ss:bp+6]         ; Check x-coordinate
  33.    cmp   ax,0
  34.    jl    short outside
  35.    cmp   [ds:Width],ax
  36.    jle   short outside
  37.    mov   ax,[ss:bp+8]         ; Check y-coordinate
  38.    cmp   ax,0
  39.    jl    short outside
  40.    cmp   [ds:Height],ax
  41.    jle   short outside
  42.  
  43.    ; Calculate the absolute address of pixel
  44.  
  45.    xor   eax,eax              ; Calculate the address of line
  46.    mov   ax,[ss:bp+8]
  47.    xor   ebx,ebx
  48.    mov   bx,[ds:LWidth]
  49.    mul   ebx
  50.    mov   bx,[ss:bp+6]         ; Calculate the address of pixel
  51.    add   eax,ebx
  52.    add   eax,[ds:AStart]      ; Add start address of active page
  53.    mov   edx,eax
  54.  
  55.    ; Check if window has to be repositioned
  56.  
  57.    cmp   [ds:RAStart],edx
  58.    jbe   short check2
  59.    call  far vesa_repos_r
  60. check2:
  61.    mov   ecx,edx
  62.    sub   ecx,[ds:RAStart]
  63.    cmp   [ds:WSize],ecx
  64.    ja    short draw_pixel
  65.    call  far vesa_repos_r
  66.  
  67.    ; Draw pixel to screen
  68.  
  69. draw_pixel:
  70.    sub   edx,[ds:RAStart]
  71.    mov   di,dx
  72.    mov   ax,[ds:WWSeg]
  73.    mov   es,ax
  74.    mov   al,[es:di]
  75.  
  76. outside:
  77.    pop   di
  78.    pop   es
  79.    pop   ds
  80.    pop   bp
  81.    retf
  82.  
  83. endp
  84.  
  85. ends
  86.  
  87. end
  88.